#include "rtda/heap/cp_memberref.h"
#include "classfile/class_file.hpp"

namespace jvm {
namespace heap {

MemberRef::MemberRef(std::shared_ptr<ConstantPool> pCp) : SymRef(pCp) {}

void MemberRef::copyMemberRefInfo(const std::shared_ptr<classfile::ConstantMemberRefInfo> pRefInfo) {
    m_className = pRefInfo->get_class_name();
    auto [name, descriptor] = pRefInfo->get_name_and_type();
    m_name = name;
    m_descriptor = descriptor;
}

const std::string& MemberRef::getName() const { return m_name; }
const std::string& MemberRef::getDescriptor() const { return m_descriptor; }

} // namespace heap
} // namespace jvm